package org.datavis.util;

public final class ChartUtil {

	 //calculate amount of decimals (negative means amount of 0 digits below zero)
	 public static int calculateDecimals (Double d){
		int decimals = 0;
		 if(d < 1)
		 {
			 while (d<=1)
			 {
				decimals--;
				d= d*10;
			 }
		 }
		 else
		 {
			 while (d>=1)
			 {
				decimals++;
				d= d/10;
			 }
			 decimals--;
		 }		 
		 return decimals;
	 }
}
